<?php
	$cs = Yii::app()->getClientScript();
    $cs->registerScriptFile('/scripts/ckeditor/ckeditor.js');
    $cs->registerScriptFile('/scripts/ckeditor/ckfinder/ckfinder.js');
?>

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
	'id'=>'product-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array(
        'enctype'=>'multipart/form-data'
    )
)); ?>

	<p class="help-block">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<?php #echo $form->textFieldRow($model,'cat_id',array('class'=>'span5','maxlength'=>11)); ?>
	<label>Chuyên mục</label>
	<?php echo CHtml::dropDownList('cat_id','',$listCat,array(
        	'name'=>'Product[cat_id]',
        )); ?>

	<?php echo $form->textFieldRow($model,'title',array('class'=>'span5','maxlength'=>255)); ?>

	<?php echo $form->textFieldRow($model,'title_en',array('class'=>'span5','maxlength'=>255)); ?>

	<?php echo $form->textFieldRow($model,'code',array('class'=>'span5','maxlength'=>255)); ?>

	<?php echo $form->textFieldRow($model,'cost',array('class'=>'span5','maxlength'=>255)); ?>

	<?php #echo $form->textFieldRow($model,'count_view',array('class'=>'span5')); ?>

	<?php echo $form->textAreaRow($model,'desc',array('rows'=>6, 'cols'=>50, 'class'=>'span8')); ?>

	<?php echo $form->textAreaRow($model,'detail',array('rows'=>6, 'cols'=>50, 'class'=>'span8')); ?>

	<?php echo $form->textFieldRow($model,'cost_en',array('class'=>'span5','maxlength'=>255)); ?>

	<?php echo $form->textAreaRow($model,'desc_en',array('rows'=>6, 'cols'=>50, 'class'=>'span8')); ?>

	<?php echo $form->textAreaRow($model,'detail_en',array('rows'=>6, 'cols'=>50, 'class'=>'span8')); ?>

	<label>Sản phẩm hot</label>
	<?php echo CHtml::dropDownList('is_hot',(empty($model->is_hot))? $model->is_hot : 1 ,array(
    		'0'=>'No',
    		'1'=>'Yes',
		),
        array(
        	'name'=>'Product[is_hot]',
        )
	); ?>

	<?php #echo $form->textFieldRow($model,'created_time',array('class'=>'span5')); ?>

	<?php #echo $form->textFieldRow($model,'img',array('class'=>'span5','maxlength'=>255)); ?>

	<div class="row">
		<label>Images</label>
		<input type="file" name="image" id="input_image">
	</div>

	<div class="form-actions">
		<?php $this->widget('bootstrap.widgets.TbButton', array(
			'buttonType'=>'submit',
			'type'=>'primary',
			'label'=>$model->isNewRecord ? 'Create' : 'Save',
		)); ?>
	</div>

<?php $this->endWidget(); ?>

<script language="JavaScript">
CKEDITOR.replace( 'Product[detail]',
{
    filebrowserBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Images',
    filebrowserFlashBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Flash',
    filebrowserUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
}
);

CKEDITOR.replace( 'Product[detail_en]',
{
    filebrowserBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Images',
    filebrowserFlashBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Flash',
    filebrowserUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
}
);

</script>